home *** CD-ROM | disk | FTP | other *** search
- Path: news.microsoft.com!news
- From: a-cnadc@microsoft.com (Dann Corbit)
- Newsgroups: comp.lang.c++
- Subject: Re: No struct in C++!!?
- Date: 15 Feb 1996 01:38:38 GMT
- Organization: Microsoft Corporation
- Message-ID: <4fu2qu$15g@news.microsoft.com>
- References: <1996Feb14.151620.5532@queens-belfast.ac.uk>
- NNTP-Posting-Host: 157.57.171.202
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.14
-
- In article <1996Feb14.151620.5532@queens-belfast.ac.uk>, gbw@harrier.am.qub.ac.uk says...
- >
- >Hi,
- >
- >a beginners question: I found in different C++ books examples of C++ programms
- >which contain type declarations and definitions in the main() programm - for
- >example a struct - as in C.
- >My question is, whether this is a contradiction
- >to the paradigm of C++. Shouldn't be everything in a C++ programm
- >either classes, objects or the interaction between objects?
- >So is it bad C++ style, to use functions or data outside from
- >classes (objects)?
- >
- >Thanks!
- >
- >Georg Woeste
- C++ is (for the most part) a superset of C. That means that you
- don't have to write object oriented code if you don't want to.
- You can use it as "a better C" if you like. Even in C++ not all
- data items are objects in well written object oriented code.
- Consider primitive data types like "double". We don't say:
-
- double dNum = 5.
- double dAns;
- dAns.exp(5);
-
- To find the exponential of five, instead we just:
-
- double dNum = 5.
- double dAns;
- dAns = exp(5);
-
- --
- The opinions expressed in this message are my own personal views
- and do not reflect the official views of Microsoft Corporation.
-
-